<div class="section" id="sitemaplist">
	<form action="" name="formlist" id="formlist" method="post">
	<div class="section-title">
		<?php echo $this->document->text['text_header_searchorder']?>
		  <div class="button right">
			<input class="button" type="button" name="print" value="<?php echo $this->document->text['text_printthislist']?>" onclick="printlist()"/>  
			<input class="button" type="button" name="close" value="<?php echo $this->document->text['button_close']?>" onclick="window.close()"/>  
			<input type="hidden" name="display" id="display" value="" />
		</div>
		<div class="clearer">^&nbsp;</div>
	</div>
    
    <div class="section-content">
    	<div>
			<b><?php echo $this->document->text['text_ordertype']?></b><select name="search_ordertype" style="width:250px"><?php echo $cb_ordertype?></select>
			&nbsp;&nbsp;
			<b><?php echo $this->document->text['text_datefrom']?> : </b><input type="text" class="text" size="10" name="search_fromdate" id="search_fromdate" value="<?php echo $search_fromdate?>"  /><b><?php echo $this->document->text['text_to']?></b><input type="text" class="text" size="10" name="search_todate" id="search_todate" value="<?php echo $search_todate?>"  />
			<input class="button" value="<?php echo $this->document->text['button_search']?>" type="submit">
		</div>
            <div class="sitemap treeindex" style="width:1600px">
                <table class="data-table" cellpadding="0" cellspacing="0">
                <tbody>
                    <tr class="tr-head">
                        <th width="30px"><input class="inputchk" type="checkbox" onclick="$('input[name*=\'delete\']').attr('checked', this.checked);"></th>
						<th width="60px"><?php echo $this->document->text['button_edit']?></th>
                        <th width="200px"><?php echo $this->document->text['text_type']?></th>
						<th width="300px"><?php echo $this->document->text['text_creator']?></th>
                        <th width="100px"><?php echo $this->document->text['text_orderno']?></th>
						<th width="100px"><?php echo $this->document->text['text_date']?></th>
						<th width="150px"><?php echo $this->document->text['text_ordertotal']?></th>
						<th width="100px"><?php echo $this->document->text['text_barcode']?></th>
						<th width="300px"><?php echo $this->document->text['text_product']?></th>
						<th width="50px"><?php echo $this->document->text['text_unit']?></th> 
						<th width="80px"><?php echo $this->document->text['text_qty']?></th>
						<th width="150px"><?php echo $this->document->text['text_price']?></th>
						<th width="200px"><?php echo $this->document->text['text_totalproducts']?></th>
						<th width="200px"><?php echo $this->document->text['text_note']?></th>
						<th width="120px"><?php echo $this->document->text['text_customersupplier']?></th>
						<th width="200px"><?php echo $this->document->text['text_address']?></th>
						<th width="120px"><?php echo $this->document->text['text_phone']?></th>                                       
                    </tr>
        
        
        <?php
            foreach($orders as $order)
            {
        ?>
                    <tr>
						<td><input class="inputchk" type="checkbox" name="delete[<?php echo $order['orderid']?>]" value="<?php echo $order['orderid']?>" >&nbsp;</td>
                        <td><a class="orderlink button" ref="<?php echo $link[$order['ordertype']].$order['orderid']?>&type=edit"><?php echo $this->document->text['button_edit']?></a></td>
						<td><?php echo $ordertypename[$order['ordertype']]?></td>
                        <td><?php echo $order['creatorname']?></td>
						<td><?php echo $order['ordernumber']?></td>
						<td><?php echo $this->date->formatMySQLDate($order['orderdate'])?></td>
                        <td><?php echo $order['grandtotal']?></td>
						<td><?php echo $order['product_barcode']?></td>
						<td><?php echo $order['product_productname']?></td>
                        <td><?php echo $order['product_unit']?></td>
						<td><?php echo $order['product_qty']?></td>
						<td><?php echo $order['product_orderprice']?></td>
                        <td><?php echo $order['product_grandtotal']?></td>
						<td><?php echo $order['note']?></td>
						<td><?php echo $order['partner_fullname']?></td>
                        <td><?php echo $order['partner_address']?></td>
						<td><?php echo $order['partner_phone']?></td>                    
                    </tr>
        <?php
            }
        ?>
                        
                                                    
                </tbody>
                </table>
            </div>
        
        
        </form>
        
    </div>
    
</div>
<script language="javascript">
$(function() {
		$("#search_fromdate").datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'dd/mm/yy'
				});
		
		
		$("#search_todate").datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'dd/mm/yy'
				});		
		
		$('.orderlink').click(function(){
			url = $(this).attr("ref");
			var result = window.showModalDialog(url, "", "dialogWidth:1020px; dialogHeight:600px; center:yes");
			$("#formlist").submit();
		});
		
		/*$('.orderlink').popupWindow({ 
			height:600, 
			width:1020, 
			centerScreen:1,
			scrollbars: 1,
			resizable : 1,
			status: 0,
			location: 0
		});*/ 
		
});
		
		

function deleteList1()   
{
	$.post("?route=voucher/search/deleteorder", 
			$("#formlist").serialize(), 
			function(data)
			{
				if(data!="")
				{
					alert(data)
					linkto("?<?php echo $refres?>")
				}
			}
	);
}

function printlist()   
{
	$("#display").val("report");
	$("#formlist").attr("target","_self");
	$("#formlist").submit();
	$("#display").val("report");
	$("#formlist").attr("target","");
}

</script>
